/*
 * constantes.h
 *
 *  Created on: 11-nov-2009
 *      Author: pablo
 */

#ifndef CONSTANTES_H_
#define CONSTANTES_H_

//booleanos
#define B_TRUE 1
#define B_FALSE 0

// para hacer debug: 5 niveles que podemos cambiar, es interno para pruebas
#define DEBUG_CONSULTA 1
#define DEBUG_LISTAS 1
#define DEBUG_MENSAJE 1
#define DEBUG_LOGICA 1
#define DEBUG5 1

#define BIND_COLA 10 //num de conexiones max en la cola de BIND
#define TAM_MAX_NOMBRE_ARCHIVO 1024
#define TAM_MAX_URL 1024
#define TAM_MAX_PAR 1024
#define TAM_MAX_LINEA 256
#define VEL_MIN 0
#define TTL_DEFECTO 0
#define PUERTO_DEFECTO_RWC 80
#define PAYLOAD_QUERY 0x80
#define PAYLOAD_QUERY_HIT 0x81
#define PAYLOAD_BYE 0x02
/* VALORES NECESARIOS PARA HTTP */
#define VERSION "0"
#define REVISION "1"
#define CR 0x0D
#define LF 0x0A
/*  CADENAS DE CARACTERES FIJAS EN HTTP*/
#define GET "GET "
#define SEPARADOR "/"
#define HTTP_V_R "HTTP/1.1"
#define USER_AGENT "User-Agent: ROtella/"
#define CONNECTION_CLOSE "Connection: close"
#define HOST "Host: "
#define SERVER_ROTELLA "Server: ROtella"
#define BYE "Bye-Packet: 0.1"
#define OK "OK!"
#define ROTELLA_CONNECT "ROTELLA CONNECT/"
#define ROTELLA "ROTELLA/"
#define CONTENT_TYPE "Content-type: application/binary"
#define CONTENT_LENGTH "Content-length: "
/*OTRAS CADENAS*/
#define HTTP_DB "HTTP//"
#define HTTP_DB_LONG 6 // longitud de HTTP_DB
/* CODIGOS  NUMERICOS .- copiados del manual*/
#define EXITING_NORMALLY "200"
#define EXPLICIT_CLOSE "201"
#define PACKET_TOO_BIG "400"
#define DUPLICATE_MESSAGES "401"
#define RELAY_IMPROPER_QUERIES "402"
#define RELAY_LONGLIVED_MESSAGES "403"
#define TOO_MANY_UNKNOW_MESSAGES "404"
#define INACTIVITY_TIMEOUT "405"
#define FAILED_TO_REPLY "406"
#define NOT_SHARING_ENOUGH "407"
#define I_O_ERROR "500"
#define PROTOCOL_DESYNC "501"
#define OUTPUT_QUEUE_FULL "502"

#define SEG_ESPERA 1
#define MICROS_ESPERA 600
#define MAX_SALTOS	7
#define SEG_ACTUALIZACION 3600

// definicion de las longitudes de tipos de datos, q no van a cambiar
#define LENGTH_BLANK 1
#define LENGTH_PAYLOAD_TYPE 1
#define LENGTH_NUMBER_OF_HITS 1
#define LENGTH_TTL 1
#define LENGTH_HOPS 1
#define LENGTH_MINIMUM_SPEED 2
#define LENGTH_PORT 2
#define LENGTH_PUERTO_HTTP 5
#define LENGTH_BYE_CODE 3
#define LENGTH_PAYLOAD_LENGTH 4
#define LENGTH_FILE_SIZE 4
#define LENGTH_IP 4
#define LENGTH_SPEED 4
#define LENGTH_MESSAGE_ID 16
#define LENGTH_LINEA 256
#endif /* CONSTANTES_H_ */
